<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    use HasFactory;

    protected $fillable = ['company_id','name','brief','status'];
    const POSTONLY = ['company_id','name','brief','status'];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function admins()
    {
        return $this->hasMany(CompanyAdmin::class,'role_id','id')->with('admin');
    }

}
